#include<bits/stdc++.h>
#define il inline
#define ct const
#define int long long
#define pii pair<int,int>
#define fi first
#define se second
#define dl double
#define N 200010
using namespace std;
//bool ppp;
il int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	return x*f;
}
il void write(int x){
	int cnt=0;char f[40];
	if(!x) putchar('0');
	if(x<0){
		x=-x;putchar('-');
	}
	while(x){
		f[cnt++]=x%10+'0';
		x/=10;
	}
	while(cnt) putchar(f[--cnt]);
	putchar('\n');
}
pii dp[1110][1110];
int n,a[N],Q,sum[N];
il pii DP(int u,int v){
	if(v==n) return pii(sum[v-1]-sum[u],0);
	if(dp[u][v].fi!=-1) return dp[u][v];
	for(int i=v+1;i<=n;++i){
		pii tmp=DP(v,i);
		if(dp[u][v].fi<tmp.se+sum[v-1]-sum[u]+a[i])
			dp[u][v]=pii(tmp.se+sum[v-1]-sum[u]+a[i],tmp.fi);
	}
	return dp[u][v];
}
//bool pppp;
signed main(){
//	cerr<<(&ppp-&pppp)/1024.0/1024.0<<"\n";
	freopen("pockets.in","r",stdin);
	freopen("pockets.out","w",stdout);
	n=read();
	for(int i=1;i<n;++i){
		a[i]=read();sum[i]=sum[i-1]+a[i];
	}
	Q=read();
	while(Q--){
		a[n]=read();
		for(int i=1;i<=n;++i) for(int j=i+1;j<=n;++j) dp[i][j]=pii(-1,0);
		pii ans=DP(1,2);
		write(ans.fi+a[1]-ans.se-a[2]);
	}
	return 0;
}

